package cn.wolfcode.qo;

import cn.hutool.core.date.DateUtil;
import cn.wolfcode.domain.QuestionItem;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

@Getter
@Setter
public class LogQueryObject extends QueryObject {
    private String username;
    private String requestMethod;
    private String ip;
    private Boolean result;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date openDate;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date endDate;

    public Date getEndDate() {
        if(endDate == null){
            return null;
        }
        DateUtil.endOfDay(endDate);
        return endDate;
    }
}
